<template>
  <div id="couponlist"> 


          <el-table :data="datalist" style="width: 100%" :height="dtheight" :header-cell-style="{background:'#4F81BC',color:'white'}"
           :row-class-name="tableRowClassName"  :border="true">

                 <el-table-column label="时间"  align='center' width="180">                   
                    <template slot-scope="scope">                   
                        <span >{{ scope.row.time }}</span>
                    </template>
                </el-table-column>
                <el-table-column label="账号"  align='center' width="180">                   
                    <template slot-scope="scope">                   
                        <span >{{ scope.row.telphone }}</span>
                    </template>
                </el-table-column>
                <el-table-column label="姓名"  align='center' >                   
                    <template slot-scope="scope">                   
                        <span >{{ scope.row.nickname }}</span>
                    </template>
                </el-table-column>
                 <el-table-column :label="variable_name2 + '余额'"  align='center' >                   
                    <template slot-scope="scope">                   
                        <span >{{ scope.row.gdb }}</span>
                    </template>
                </el-table-column>
                 <el-table-column label="贡献度"  align='center' >                   
                    <template slot-scope="">                   
                        <span ></span>
                    </template>
                </el-table-column>
                <el-table-column label="所属团队"  align='center' width="250">                   
                    <template slot-scope="scope">                   
                        <span >{{ scope.row.team_leader.nickname }}{{ scope.row.team_leader.telphone }}</span>
                    </template>
                </el-table-column>
                 <el-table-column label="所属运营中心"  align='center' width="250">                   
                    <template slot-scope="scope">                   
                           <span v-if="scope.row.operate_center"> {{ scope.row.operate_center.name }}</span>
                         <span v-else>暂无</span>
                    </template>
                </el-table-column>
                <el-table-column label="数量"  align='center' >                   
                    <template slot-scope="scope">                   
                        <span >{{ scope.row.ticket_number }}</span>
                    </template>
                </el-table-column>
                <el-table-column label="状态"  align='center' >                   
                    <template slot-scope="scope">                   
                        <span v-if="scope.row.status == 0">申请中</span>
                        <span v-if="scope.row.status == 1">已完成</span>
                        <span v-if="scope.row.status == 2">已驳回</span>
                    </template>
                </el-table-column>
                <el-table-column :label="variable_name2"  align='center' >                   
                    <template slot-scope="scope">                   
                        <span v-if="scope.row.use_type == 2">{{ scope.row.use_number }}</span>
                        <span v-else>--</span>
                    </template>
                </el-table-column>
                 <el-table-column :label="variable_name1"  align='center' >                   
                    <template slot-scope="scope">                   
                         <span v-if="scope.row.use_type == 1">{{ scope.row.use_number }}</span>
                        <span v-else>--</span>
                    </template>
                </el-table-column>
              
                 <el-table-column label="操作" align='center' width="200" fixed="right">
                    <template slot-scope="scope">                           
                            <el-button v-if="scope.row.status == 0"  size="mini"  type="primary"  plain @click="agree_but(scope.row)">同意</el-button> 
                            <el-button v-if="scope.row.status == 0" size="mini"  type="primary"  plain @click="refuse_but(scope.row)">驳回</el-button>                                              
                    </template>
                </el-table-column>
  
            </el-table>  


    
        



   </div>
</template>

<script>

export default {
   name: 'couponlist',
   props:{
      datalist:{  
        //type:Array,
       default:()=>[]
     },
  },
  data () {
    return {
        dtheight:'500',  //窗口高度
    }
  },
   components:{

  },
  created(){
     this.dtheight = window.innerHeight - 305
      
  },
  mounted (){
    
  },
  methods: {
    
    agree_but(row){
        this.$confirm('是否同意, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
         }).then(() => {
            this.post("/gdb_ticket/agreee", {
                    id:row.id,
                }).then(res => {
                    if(res.error_code == 0){
                        this.open1(res.result,'success')  //提示框
                        this.$emit('up_list_fun')
                    }else {
                      this.open1(res.message,'warning')
                }

             })
        }).catch(() => {
            
        });
    },
    refuse_but(row){
        this.$confirm('是否拒绝, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
         }).then(() => {
            this.post("/gdb_ticket/refuse", {
                    id:row.id,
                }).then(res => {
                    if(res.error_code == 0){
                        this.open1(res.result,'success')  //提示框
                        this.$emit('up_list_fun')
                    }else {
                      this.open1(res.message,'warning')
                }

             })
        }).catch(() => {
               
        });
    }

  }
}
</script>


<style scoped>

</style>